package adapter.example;

public class AdapterPattern {

    public static void main(String[] args) {
        MallardDuck duck = new MallardDuck();

        WildTurkey turkey = new WildTurkey();
        Duck turkeyAdapter = new TurkeyAdapter(turkey);

        System.out.println("The Turkey says...");
        turkey.gobble();
        turkey.fly();

        System.out.println("\nThe Duck says...");
        test(duck);

        System.out.println("\nThe TurkeyAdapter says...");
        test(turkeyAdapter);

        System.out.println("----------");

        Turkey duckAdapter = new DuckAdapter(duck);

        System.out.println("The Duck says...");
        duck.quack();
        duck.fly();

        System.out.println("\nThe Turkey says...");
        test(turkey);

        System.out.println("\nThe DuckAdapter says...");
        test(duckAdapter);
    }

    public static void test(Duck duck) {
        duck.quack();
        duck.fly();
    }

    public static void test(Turkey turkey) {
        turkey.gobble();
        turkey.fly();
    }

}
